import http from './request.js'

// 获取轮播图图片
	export const getlunboData = async () => {
		return await http.get('/api/getlunbo')
		// 根据设置好的拦截器，res已经是response.data了，所以不需要再进行.data了
	}

// 获取商品列表
	export const getGoodsList = async (page = 1, limit = 8) => {
		return http.get(`/api/recommend?page=${page}&limit=${limit}`)
	}

// 获取分类区域的每个项的接口数据
	export const getCategoryData = () => {
		return http.get('/api/getcategory')
	}
	
// 获取分类区域的商品列表
	export const getcategoryDataList = async (id) => {
		return http.get(`/api/getcategorygoods?category_id=${id}`)
	}

// 获取商品详情页轮播图
	export const getGoodsDetailLunbo = async (id) => {
		return http.get(`/api/getthumbimages/${id}`)
	}
	
// 获取商品详情页商品信息
	export const getGoodsDetailmsg = async (id) => {
		return http.get(`/api/getgoodsinfo/${id}`)
	}
	
// 获取用户地址信息
	export const getAddressMsg = async () => {
		return http.get(`/api/getaddress/`)
	} 
	
// 添加用户地址信息
	export const getAddAddressMsg = async () => {
		return http.post(`/api/addaddress/`)
	}
	
// 发送登录请求
	export const sendLoginReq = (data) => {
		return http.post('/api/login', data)
	}